package com.gj.subclass.enumpackge;

/**
 * Created by Tangyunhen on 2021-06-24.
 */
public enum StatusEnum2 {
    QIYONG(1,"启用"),JINYONG(0,"禁用"),QUANBU(2,"全部"),SUIBIAN(3,"随便");
    //枚举以Key Value的形式储存 KEY可以随便定义
    //必须定义value的类型
    private Integer status;
    private String statusName;
    //必须有一个构造方法

    StatusEnum2(Integer status,String statusName) {
        this.status = status;
        this.statusName = statusName;
    }
    public String getStatusName(){
        return statusName;
    }
    public Integer getStatus(){
        return status;
    }
    public static String getStatusName(Integer status) {
        for (StatusEnum2 c : StatusEnum2.values()) {
            if (status==c.getStatus()){
                return c.getStatusName();
            }
        }return  null;
    }

}
